import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2024-09-26
 * Time: 13:00
 */
public class Main {
    public static List<List<Integer>> demo(int n){
        //杨辉三角
        List<List<Integer>> list=new ArrayList<>();
        for (int i = 0; i < n; i++) {
            List<Integer> e =new ArrayList<>();
            list.add(e);
            //第一列
            list.get(i).add(1);
            //中间
            for (int j = 1; j < i; j++) {
                int z=list.get(i-1).get(j)+list.get(i-1).get(j-1);
                list.get(i).add(z);
            }
            //最后
            if(i!=0){
                list.get(i).add(1);
            }
        }return list;

    }
    public static void main(String[] args) {
        //用顺序表实现杨辉三角
        System.out.println(demo(4));
        List<List<Integer>> list=demo(4);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

    }
    public static void main1(String[] args) {
        //welcome to China
        //come
        //创建一个新顺序表
        String str1="welcome to China";
        String str2="come";
        ArrayList<Character> ret=new ArrayList<>();

        for (int i = 0; i < str1.length(); i++) {
            char a=str1.charAt(i);
            if(!str2.contains(a+"")){
                ret.add(a);
            }
        }
        System.out.println(ret);
    }
}